/**
 * Form
 */
var React = require('react-native');
var {View} = React;

//just do nothing.
var noop = (e) => {};

/**
 * Usage:
 */
var Form = React.createClass({
  /**
   * 默认属性
   */
  getDefaultProps() {
    return {
      onChange: noop
    }
  },


  render() {
    return (
      <View onChange={this._handleChange} style={this.props.style}>
        {this.props.children}
      </View>
    )
  },


  /**
   * handle form的field的改变
   *
   * TODO 可能onChange并不能满足我们的场景，可能还需要处理onChangeText
   */
  _handleChange(e) {
    this.props.onChange(e);
  }
});


//输入框
Form.QMTextInput = require('./text-input');
//日期控件
Form.QMDateInput = require('./date-input');
//只读组件
Form.QMTextField= require('./text-field');


module.exports = Form;
